<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Aduserm extends CI_Controller {
function __construct()
        {
            parent::__construct();
			$this->load->model('adduser');
			$this->load->library('session');
			
			if( !$this->session->userdata('isLoggedIn') ) redirect ('front/signin');
			
        }



	public function userM()
	{
		$this->load->model('adduser');
		
		$page = $this->input->get('page');
		$itemPerPage = 5;
		
		$first=0;
		if($page != null){
			$first = ($itemPerPage * ($page-1));
		}
		
		$data['title']	= '| User Managemenr';
		$data['users'] 	= $this->adduser->selectAll($first, $itemPerPage);
		$data['total'] 	= $this->adduser->getTotalRecords();
		$data['main'] 	= 'admin/userM/v_adUserM';
		
		$this->load->view('v_template',$data);
	}	

	public function tambahUser()
	{
	/* $this->load->model(‘adduser’); */
		$data['title']	= '| Tambah User';
		$data['main']	= 'admin/userM/v_adTambahUserM';
		$this->load->view('v_template',$data);
		
		
		

		//$this->load->view('admin/userM/v_adTambahUserM');
		
	}
	public function input ()
	{
		/* $this->adduser->add_user(); */
		$this->load->model('adduser');
		$this->adduser->add_user();
		
		$this->load->model('adduser');
		$this->adduser->add_pegawai();
	
		//membuka halaman add user
		
		//$this->userM();
		$this->load->helper('url');
		redirect('admin/aduserm/userM');
		$this->input->post('tanggal_lahir');
		//echo $this->input->post('role');
		
		

/* $data['konfir_simpan'] = ‘Data user berhasil disimpan’;
$data['judul']=’Insert Data Berhasil’; */
/* $this->load->view(‘notifikasi_simpan’, $data); */

	}
	
	public function editUser()
	{
		$this->load->model('adduser');
		
		$data['title']	= '| Edit User';
		$data['users'] 	= $this->adduser->selectUserByID($this->input->get('id'));
		
		$data['main']	= 'admin/userM/v_adEditUserM';
		
		$this->load->view('v_template',$data);
	}

	public function lihatUser()
	{
		$this->load->model('adduser');
		
		$data['users'] = $this->adduser->selectUserByID($this->input->get('id'));
		$data['main']= 'admin/userM/v_adlihatUserM';
		
		$this->load->view('v_template',$data);
	}
	
	public function submitEdit()
	{
		$this->load->model('adduser');
		$this->adduser->edit();
		
		$this->userM();
	}
	
}

/* End of file adUserM.php */
/* Location: ./application/controllers/admin/adUserM.php */